package com.ldy.seal.vo;

import com.itextpdf.text.Image;
import com.itextpdf.text.Rectangle;

/**
 * 关键字信息
 * 
 * @author lindeyi
 *
 */
public class KeywordInfo implements ISeal {

	private int page;

	private float centreX;

	private float centreY;

	/**
	 * 默认构造函数
	 */
	public KeywordInfo() {
		super();
	}

	/**
	 * 构造函数
	 * @param page 页码
	 */
	public KeywordInfo(int page) {
		super();
		this.page = page;
	}

	/**
	 * copy
	* @return KeywordInfo
	 */
	public KeywordInfo copy() {
		return new KeywordInfo(this.page);
	}


	/**
	 * @return the page
	 */
	public int getPage() {
		return page;
	}

	/**
	 * @param page the page to set
	 */
	public void setPage(int page) {
		this.page = page;
	}

	/**
	 * @return the centreX
	 */
	public float getCentreX() {
		return centreX;
	}

	/**
	 * @param centreX the centreX to set
	 */
	public void setCentreX(float centreX) {
		this.centreX = centreX;
	}

	/**
	 * @return the centreY
	 */
	public float getCentreY() {
		return centreY;
	}

	/**
	 * @param centreY the centreY to set
	 */
	public void setCentreY(float centreY) {
		this.centreY = centreY;
	}

	/**
	 * 获取签章范围
	* @param signImage 印章图片
	* @param scale     缩放比
	* @return Rectangle
	 */
	@Override
	public Rectangle getRectangle(Image signImage, float scale) {
		// 自己可以调整图片的大小
		float halfWith = signImage.getWidth() * (scale / 100) / 2;
		float halfHeight = signImage.getHeight() * (scale / 100) / 2;

		return new Rectangle(this.centreX - halfWith, this.centreY - halfHeight, this.centreX + halfWith,
				this.centreY + halfHeight);

	}
}